import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TCopyMarkLevel } from "../../../Message/Db/Tables/TCopyMarkLevel";
import { ItemData } from "./info/ItemData";
type int = number;
//class CopyMarkLevelConfig
    
    export  class CopyMarkLevelConfig
    {
        constructor()
        {
            
            this._dic = new Map<any, any> /* flash.utils.Dictionary */();
            if (CopyMarkLevelConfig._instance != null) 
            {
                new Error("CopyMarkLevelConfig单例不能new");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_copy_mark_level.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                if (loc2 == null) 
                {
                    continue;
                }
                loc1 = new TCopyMarkLevel();
                loc1.award = loc2.award;
                loc1.copyCode = loc2.copyCode;
                loc1.credit = loc2.credit;
                loc1.markLevel = loc2.markLevel;
                loc1.markName = loc2.markName;
                this._dic[loc1.copyCode + "-" + loc1.markLevel] = loc1;
            }
            return;
        }

        public getKingCopyRewards(arg1: int, arg2: int): Array<any>
        {
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc1=[];
            var loc2;
            if (loc2 = this.getItemByCodeAndLevel(arg1, arg2)) 
            {
                loc3 = loc2.award.split("#");
                loc6 = 0;
                while (loc6 < (loc3.length - 1)) 
                {
                    loc4 = String(loc3[loc6]).split(",");
                    (loc5 = new ItemData(int(loc4[1]))).data.itemAmount = int(loc4[2]);
                    loc1.push(loc5);
                    ++loc6;
                }
            }
            return loc1;
        }

        public getItemByCodeAndLevel(arg1: int, arg2: int): TCopyMarkLevel
        {
            return this._dic[arg1 + "-" + arg2] as TCopyMarkLevel;
        }

        public static get instance(): CopyMarkLevelConfig
        {
            if (CopyMarkLevelConfig._instance == null) 
            {
                CopyMarkLevelConfig._instance = new CopyMarkLevelConfig();
            }
            return CopyMarkLevelConfig._instance;
        }

        /* internal */ /* var */_dic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: CopyMarkLevelConfig;
    }
